import http from "@/utils/request";

//  获取所有商品信息的接口
export function getAllProductRequest (currentPage,pageSize,goodsName) {
    return http({
        url:'/product',
        method:'get',
        data:{},
        params:{currentPage,pageSize,goodsName}
    })
}

//  添加商品信息的接口
export function insertProductRequest (insertData) {
    return http({
        url:'/product',
        method:'post',
        data:insertData
    })
}

//  根据id查询商品信息的接口
export function getProductByIdRequest (goodsId) {
    return http({
        url:`/product/${goodsId}`,
        method:'get',
        data:{}
    })
}

//  根据id修改商品信息的接口
export function updateProductRequest (goodsData) {
    return http({
        url:'/product',
        method:'put',
        data:goodsData
    })
}

//  根据id删除商品信息的接口
export function deleteProductRequest (goodsId) {
    return http({
        url:`/product/${goodsId}`,
        method:'delete',
        data:{}
    })
}

//  根据商品名称模糊查询商品信息的接口
export function searchProductRequest (goodsName) {
    return http({
        url:'/product/searchByGooodsName',
        method:'get',
        params:{goodsName}
    })
}

//  导出商品信息到Excel的接口
export function getExpProductRequest () {
    return http({
        url:'/product/export',
        method:'get'
    })
}